import useRequest from "@/api/useRequest";
import {IPage} from "@/interface/modules/system";


export class voiceController {

  static listFromChapter(data:any): Promise<any> {
    return useRequest({
      url: "/tts/articleDetail/listFromChapterId",
      method: "post",
      data
    })
  }

  static getVoiceByLocaleName(data:any): Promise<any> {
    return useRequest({
      url: "/tts/voice/actor/getVoiceByLocaleName",
      method: "post",
      data
    })
  }


  static updateDetail(taskId: string): Promise<any> {
    return useRequest({
      url: "/tts/articleDetail/edit",
      method: "get",
    })
  }

  static formatStory(data:any): Promise<any> {
    return useRequest({
      url: "/story/formatStory",
      method: "post",
      data
    })
  }


  static listVoice(pagination?: IPage): Promise<any>{
    return useRequest({
      url: "/tts/listVoice",
      method: "post",
      params: pagination
    })
  }

    static listVoiceActors(data:any): Promise<any> {
        return useRequest({
            url: "/tts/voicelist/",
            method: "post",
            data
        })
    }

    static getLastStory(): Promise<any> {
      return useRequest({
        url: "/story/getLastStory",
        method: "get"
      })
    }

    static voicePreview(data:any): Promise<any> {
        return useRequest({
            url: "/tts/voicePreview",
            method: "post",
            data
        })
    }

  static voiceGenerate(data:any): Promise<any> {
    return useRequest({
      url: "/tts/generate",
      method: "post",
      data
    })
  }

  static voiceGenerateShort(data:any): Promise<any> {
    return useRequest({
      url: "/tts/generateShortVoice",
      method: "post",
      data
    })
  }

  static voiceDelete(id:string): Promise<any> {
    return useRequest({
      url: "/tts/deleteVoice/" + id,
      method: "get"
    })
  }

  static previewAudio(data:any): Promise<any> {
    return useRequest({
      url: "/tts/voicePreview",
      method: "post",
      data
    })
  }

  static getVoiceTaskList(voiceId:string): Promise<any> {
    return useRequest({
      url: "/tts/getTTSTaskByVoiceId/"+voiceId,
      method: "get"
    })
  }

  static restartVoiceTask(taskId:string): Promise<any> {
    return useRequest({
      url: "/tts/restartVoiceTask/"+taskId,
      method: "get"
    })
  }

}

